/**
 * Friendly Interactive Recursion Educator (FIRE)
 * COMS 4115: Programming Languages & Translators
 * Prof. Aho
 * 
 * @author Brian Lu
 * @author Sahar Hasan
 * @author Steve Hehl
 * @author Tristan Naumann
 * @version 2009-05-12
 */
package firesymbols;

import java.util.ArrayList;

/**
 * FunctionSymbol is to be used for type checking that a function takes the
 * correct argument types and is used to return an appropriate argument types
 */
public class FunctionSymbol extends Symbol {
	
	private ArrayList<Symbol> args = new ArrayList<Symbol>(); // return,arg types
	private boolean isRecursive;		// is the tracked recursive function
	
	public FunctionSymbol(String name, Symbol returnType, boolean recursive){
		super(name, returnType);
		isRecursive = recursive; 
		args.add(0, returnType); //return type always in position 1
		

	}
	
	public boolean isRecursive(){
		return isRecursive;
	}
	
	/**
	 * Add arguments to the function.
	 * @param args defines the arguments of the function
	 */
	public void setArgs(ArrayList<Symbol> args){
		for(int i = 0; i < args.size(); i++){
			this.args.add(i+1, args.get(i));
		}
		
	}
	
	// Returns the argument list for the function.
	public ArrayList<Symbol> getSignature(){
		return args;
	}

}
